


function companyChange() {

    var cboCompany = $('#CompanyCbo');
    var imgCompany = $('#ImgEmpresa');
    var lblPtoVtaInfo = $('#lblPtoVtaInfo');

    if (cboCompany.val() != '-1' && cboCompany.val() != undefined) {
        lblPtoVtaInfo.html($('#cboCompany option:selected').text());

        if (companies) {
            //imgCompany.attr('src', companies[cboCompany.val()]);

            var companyCustomSplit = companies[cboCompany.val()].split('##');

            $("link[href^='/Styles/Company']").attr('disabled', true);
            $("link[href^='/Styles/Company']").remove();

            // Luego cambio el CSS y la imagen        
            imgCompany.attr('src', companyCustomSplit[0]);

            var urlStyleSheet = '/Styles/Company/' + companyCustomSplit[1];            
            if (document.createStyleSheet) {
                document.createStyleSheet(urlStyleSheet);
            }
            else {
                $('head').append('<link href="' + urlStyleSheet + '" rel="stylesheet" type="text/css" />');
            }                      
        }

        $('#hidCompany').val(cboCompany.val());

    }
    else {
        lblPtoVtaInfo.html("Marca no seleccionada");
        imgCompany.attr('src', '');
    }
};
